home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / MATH / FSULTRA1.ZIP / ULTRX_TP.ASM < prev    next >
Assembly Source File  |  1992-06-18  |  3KB  |  136 lines

  1. comment ! 
  2. FSU - ULTRA    The greatest random number generator that ever was
  3.         or ever will be.  Way beyond Super-Duper.
  4.         (Just kidding, but we think its a good one.)
  5.  
  6. Authors:    Arif Zaman (arif@stat.fsu.edu) and
  7.         George Marsaglia (geo@stat.fsu.edu).
  8.  
  9. Date:        27 May 1992
  10.  
  11. Version:    1.05
  12.  
  13. Copyright:    To obtain permission to incorporate this program into
  14.         any commercial product, please contact the authors at
  15.         the e-mail address given above or at
  16.  
  17.         Department of Statistics and
  18.         Supercomputer Computations Research Institute
  19.         Florida State University
  20.         Tallahassee, FL 32306.
  21.  
  22. See Also:    README        for a brief description
  23.         ULTRA.DOC    for a detailed description
  24.  
  25. -----------------------------------------------------------------------
  26. ;
  27. ; File: ULTRX_TP.ASM  (80386 Turbo Pascal calling conventions)
  28. ;
  29.     DOSSEG
  30.    .MODEL TPASCAL
  31.  
  32. ;===== B: GLOBAL FUNCTIONS, SUBROUTINES and VARIABLES =================
  33. ;
  34.     public  i31bit, i15bit, i7bit,  i1bit,  uni,    duni
  35.     public  i32bit, i16bit, i8bit,  rinit,  vni,    dvni
  36.  
  37. ;===== D. MACRO DEFINITIONS ===========================================
  38. ;
  39. ; RinitProcStart should take two 32-bit arguments conx and shrx
  40. ;   and place them in eax and ebx.
  41. ;   es and ds should both point to the data segment.
  42. ;   conx must be odd (so we or with 1 just to make sure).
  43. ; FillProc
  44. ;   DS is already the data segment. ES should also be made the same.
  45.  
  46. EnterProcedure   macro
  47. endm
  48.  
  49. ExitProcedure    macro
  50.     ret
  51. endm
  52.  
  53. Enter2arg   macro
  54.   arg conx:dword, shrx:dword
  55.   EnterProcedure
  56.     mov ax,ds
  57.     mov es,ax
  58.     mov eax,conx
  59.     shl eax,1
  60.     or  al,1
  61.     mov ebx,shrx
  62. endm
  63.  
  64. Exit2arg     macro
  65.   ExitProcedure
  66. endm
  67.  
  68. EnterFill    macro
  69.     mov    ax,ds
  70.     mov    es,ax
  71. endm
  72.  
  73. ExitFill    macro
  74.     ret
  75. endm
  76.  
  77. DwordFn macro
  78. endm
  79.  
  80. WordFn  macro
  81. endm
  82.  
  83. ByteFn  macro
  84. endm
  85.  
  86. RealFn  macro
  87. endm
  88.  
  89. DoubleFn macro
  90. endm
  91.  
  92. ;===== DATA ========================================================
  93.  
  94.   N equ 37              ; The number of 32 bit words in the table
  95.   N2 equ 24             ;  x(i) = x(i-N) - x(i-N2)
  96.  
  97. counterpoint    STRUC
  98.   c  dw 0               ; counter
  99.   p  dw ?               ; offset for pointer
  100.      dw ?               ; segment for pointer
  101.   x  dd N dup (?)    ; data
  102. ENDS
  103.  
  104.   extrn swbstate            ; In TP, the shared DATA is
  105.   cps = size counterpoint
  106.   cp1 = cps - 4*N + 32
  107.   swb32 = counterpoint ptr swbstate    ; in the TPU, so we define a
  108.   swb16 = counterpoint ptr swb32+cps    ; large array there, and refer
  109.   swb8  = counterpoint ptr swb16+cps    ; to it here. This ensures that
  110.   swb1  = counterpoint ptr swb8 +cps    ; the swbstate is contiguous.
  111.   swbseed = dword ptr swb1     + cp1
  112.   flags   = byte  ptr swbseed  + 4*N
  113.   congx   = dword ptr flags    + 1
  114.  
  115.   extrn tmpq  : qword
  116.   extrn neg31 : word
  117.   extrn neg63 : word
  118.  
  119.   conglo  = word ptr congx
  120.   conghi  = word ptr congx+2
  121.   tmpw1   = word ptr tmpq
  122.   tmpw2   = word ptr tmpq+2
  123.   tmpw3   = word ptr tmpq+4
  124.   tmpw4   = word ptr tmpq+6
  125.   tmpdlo  = dword ptr tmpq
  126.   tmpdhi  = dword ptr tmpq+4
  127.   shrglo  = tmpw1
  128.   shrghi  = tmpw2
  129.   shrgx   = tmpdlo
  130.  
  131. .CODE
  132.   INCLUDE ULTRXCOD.INC
  133. END
  134.  
  135.